<?php
  
  class LoginMain{
    var $procDir='com/login/process/';
    var $procObj;
    var $params=array();
    public function LoginMain($act,$params){
   // print($act);
      $this->loadProcess('ProcessLogin.class.php');
    //  print($act);
      $this->procObj=new ProcessLogin();
      $this->params=array($params[0],$params[1]);
      $this->addAction($act);
    }
    function loadProcess($processFile){
      
      if(file_exists($this->procDir.$processFile)){
      //print(a);
         require($this->procDir.$processFile);
         
      }
      else{
        print('Process File '.$this->procDir.$processFile.' Not Exist');
      }
     
     
    }
    function addAction($act=""){
      switch($act){
        case "doLogin":
          $this->procObj->doLogin($this->params[0],md5($this->params[1]));
        break;
        case "doLogout":
          $this->procObj->doLogout($this->params[0],md5($this->params[1]));
        break;
        default:
          die('Function '.$act.' Not Declare');
        break;
      }
    }
  }
?>
